2 * Adium is the legal property of its developers, whose names are listed in the copyright file included
3 * with this source distribution.
5 * This program is free software; you can redistribute it and/or modify it under the terms of the GNU
6 * General Public License as published by the Free Software Foundation; either version 2 of the License,
7 * or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
10 * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
11 * Public License for more details.
13 * You should have received a copy of the GNU General Public License along with this program; if not,
14 * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 #import "DCPurpleZephyrJoinChatViewController.h"
18 #import "DCJoinChatWindowController.h"
19 #import <Adium/AIAccount.h>
21 @interface DCPurpleZephyrJoinChatViewController (PRIVATE)
22 - (void)validateEnteredText;
25 @implementation DCPurpleZephyrJoinChatViewController
29 return @"DCPurpleZephyrJoinChatView";
32 - (void)configureForAccount:(AIAccount *)inAccount
34 [self validateEnteredText];
36 [[view window] makeFirstResponder:textField_class];
38 [super configureForAccount:inAccount];
42 Zephyr uses "class" "instance" and "recipient". Instance and Recipient are optional and will become "*" if
43 they are not specified; we show this default value automatically for clarity.
46 - (void)joinChatWithAccount:(AIAccount *)inAccount
51 NSDictionary *chatCreationInfo;
53 class = [textField_class stringValue];
54 instance = [textField_instance stringValue];
55 recipient = [textField_recipient stringValue];
57 if (!instance || ![instance length]) instance = @"*";
58 if (!recipient || ![recipient length]) recipient = @"*";
60 if (class && [class length]) {
62 //The chatCreationInfo has keys corresponding to the GHashTable keys and values to match them.
63 chatCreationInfo = [NSMutableDictionary dictionaryWithObject:class
66 //The chatCreationInfo has keys corresponding to the GHashTable keys and values to match them.
67 chatCreationInfo = [NSDictionary dictionaryWithObjectsAndKeys:class,@"class",instance,@"instance",recipient,@"recipient",nil];
69 name = [NSString stringWithFormat:@"%@,%@,%@",class,instance,recipient];
71 [self doJoinChatWithName:name
73 chatCreationInfo:chatCreationInfo
75 withInvitationMessage:nil];
79 //Entered text is changing
80 - (void)controlTextDidChange:(NSNotification *)notification
82 if ([notification object] == textField_class) {
83 [self validateEnteredText];
87 - (void)validateEnteredText
89 NSString *class = [textField_class stringValue];
92 if (class && [class length]) {
97 [(DCJoinChatWindowController *)delegate setJoinChatEnabled:enabled];